﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Windows.Forms;

namespace Manager.Common
{
    class Log
    {
        public static void WriteLog(string str)
        {
            str += "\n";
            string appPath = "C:\\Logs\\";
            string dd = DateTime.Now.Day.ToString();
            string mm = DateTime.Now.Month.ToString();
            string yy = DateTime.Now.Year.ToString();
            string s = yy + "_" + mm + "_" + dd;
            //            DirectoryInfo di = new DirectoryInfo(appPath + "Log\\LogThemTin");
            appPath += s + ".txt";
            StreamWriter ss = new StreamWriter(appPath, true, System.Text.Encoding.Unicode);

            string time = DateTime.Now.ToLongTimeString();
            string message = "----------------------------------" + time + "------------------------------------\r\n";
            message += "\n" + str + "\r\n";


            ss.Write(message);
            ss.Close();
        }
    }
}
